import request from '@/utils/request'
export const login = ({ username, password }) => {
  return request({
    method: 'post',
    url: '/adminLogin',
    data: {
      username,
      password
    }
  })
}
// 获取所有管理员信息
export const getAdminAPI = () => {
  return request({
    method: 'GET',
    url: '/admin'
  })
}
// 增加管理员
export const addAdminAPI = (data) => {
  return request({
    method: 'POST',
    url: '/admin/add',
    data
  })
}
// 根据id删除管理员
export const delAdminAPI = (id) => {
  return request({
    method: 'DELETE',
    url: `/admin/delete/${id}`
  })
}
// 根据id修改管理员信息
export const updateAdminAPI = (id, data) => {
  return request({
    method: 'POST',
    url: `/admin/update/${id}`,
    data: {
      username: data.cate_username,
      password: data.cate_password,
      nickname: data.cate_nickname
    }
  })
}
